#include <jni.h>
#include <string>
#include <android/log.h>
#include <queue>
#include <cmath>
#include <stdlib.h>
#include <BST.hpp>

using namespace std;

void visit(int key, int value) {
    __android_log_print(ANDROID_LOG_ERROR, "TAG", "key=%d, value=%d", key, value);
}

extern "C"
JNIEXPORT jstring
JNICALL
Java_com_ndk_day42_MainActivity_stringFromJNI(
        JNIEnv *env,
        jobject /* this */) {

    BST<int, int> *bst = new BST<int, int>();
    bst->put(2,2);
    bst->put(-11,-11);
    bst->put(-13,-13);
    bst->put(0,0);

    bst->put(8,8);
    bst->put(3,3);
    bst->put(7,7);

    bst->remove(7);
    bst->inOrderTraverse(visit);
    // __android_log_print(ANDROID_LOG_ERROR,"TAG","%d", bst->contains(100));
    // __android_log_print(ANDROID_LOG_ERROR,"TAG","%d", bst->contains(7));

    std::string hello = "Hello from C++";
    return env->NewStringUTF(hello.c_str());
}

